home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 February / EnigmA AMIGA RUN 15 (1997)(G.R. Edizioni)(IT)[!][issue 1997-02][PLANET CD V].iso / progs / sviluppo / python-1.4 / install_python < prev    next >
Text File  |  1996-12-31  |  13KB  |  366 lines

  1. ;------------------------------------------------------------------------
  2. ;
  3. ; Python Installation script
  4. ;
  5. ; Copyright © 1996,1997 Irmen de Jong.
  6. ; V2.3 (28-dec-96)
  7. ;
  8.  
  9. (set OSVersion          (/ (getversion) 65536))
  10.  
  11. (set cpu (database "cpu"))
  12.  
  13. (set @app-name "Python 1.4")
  14.  
  15. (set #source-dir (pathonly @icon) )
  16.  
  17. ;
  18. ; ENGLISH STRINGS
  19. ;
  20. (set #osmsg "ARGH! You have an obsolete Kickstart version!\n\nPython only works on Kickstart 2.04 or higher. Upgrade to 3.1!")
  21. (set #nopretendmsg "Can only install for real.")
  22. (set #welcomemsg "Installation of Python 1.4 rel. 1\n\nA new directory (with icon) will be created, in which the program is installed.")
  23. (set #oldversionmsg "\nDo you have a previous installed version, and if so, do you want to delete that (fully)?\nWARNING: If you select 'yes', the full contents of the directory of the old version will be deleted!\n\n\n(If you have a previous version installed, and you don't delete it, you must install this new version to a new directory)")
  24. (set #oldversionhelp "Yes: delete all files from old version. You can then install this new version in the place of the old one, otherwise, you'll have to install this version in a new directory.\n\nIf you have any files in the directory of the old version that you want to keep, SELECT 'NO'!")
  25. (set #whereisold "Where is your previous release installed?")
  26. (set #deleteoldmsg "\nWill now delete old version. Last chance to keep old data!")
  27. (set #willdeletemsg "\nWill now delete drawer\n\n%s\n\ncompletely.")
  28. (set #willdeletehelp "Last chance to keep old files: click 'Abort'!")
  29. (set #deleteworkmsg "Deleting %s...")
  30. (set #oldversion "old version")
  31. (set #deleteinstall "Do you want to delete the installation directory?\n\n(it is no longer needed)")
  32. (set #installationfiles "installation files")
  33. (set #whereprompt "Were must Python be installed? Most of the files don't have to be copied, if you accept the offered default.")
  34. (set #wherehelp "  Here you can specify the location where to install Python.\n  Installation can be made on-place. This is recommended if you have already unarchived the Python archive to its final location. In this case most of the files are left where they are. Only necessary files are moved to different positions.\n  If you choose another location, a new subdirectory will be created (with icon) in which the program is installed.")
  35. (set #currentmsg "\nInstalling Python to\n\n%s\n\n(the current place)")
  36. (set #existingerr "Can't install into existing directory!")
  37. (set #oldstillexistserr "Couldn't fully remove old drawer! (is it still in use?)")
  38. (set #newmsg "\nInstalling Python to\n\n%s\n\n(a new directory)" )
  39. (set #whichprompt "Which version of the program should be installed?")
  40. (set #whichhelp "Choose the version which matches your CPU/FPU configuration best.\nRead the README file for info on how to obtain other versions.\n\n")
  41. (set #startupprompt "The following commands will be added to your \"S:User-Startup\" file (You'll need them to run Python):\n\nASSIGN Python: %s\nPATH Python: ADD\n")
  42. (set #readmemsg (cat "Please read shown information...\n\n\n(It is also wise to read the README file)"))
  43. (set #ver_68020_IEEE "Python  68020, no FPU")
  44. (set #ver_68030_882  "Python  68030, 68882 FPU")
  45. (set #abort "Abort")
  46. (set #proceed "Proceed")
  47.  
  48. ;
  49. ; NEDERLANDSE STRINGS
  50. ;
  51. (if (= @language "nederlands")
  52. (
  53. (set #osmsg "ARGH! U heeft een verouderde Kickstart versie!\n\nPython werkt alleen op Kickstart 2.04 of nieuwer. Upgrade naar 3.1!")
  54. (set #nopretendmsg "Kan alleen echte installatie uitvoeren.")
  55. (set #welcomemsg "Installatie van Python 1.4 rel. 1\n\nEr wordt een nieuwe lade (met ikoon) aangemaakt, waarin het programma wordt geïnstalleerd.")
  56. (set #oldversionmsg "\nHeeft u een vorige versie geïnstalleerd, en zo ja, wilt u deze dan (in zijn geheel) verwijderen?\nWAARSCHUWING: als u 'ja' kiest, wordt de complete inhoud van de lade van de oude versie gewist!\n\n\n(Als u een vorige versie geïnstalleerd heeft, en deze niet verwijdert, moet u de nieuwe versie in een nieuwe lade installeren)")
  57. (set #oldversionhelp "Ja: verwijder alle files van de oude versie. U kunt dan deze nieuwe versie op de plaats van de oude installeren, anders moet u dat in een nieuwe lade doen.\n\nAls u files heeft in de lade van de oude versie die u wilt bewaren, KIES DAN 'NEE'!")
  58. (set #whereisold "Waar is uw vorige versie geïnstalleerd?")
  59. (set #deleteoldmsg "\nOude versie wordt nu verwijderd. Laatste kans om oude files te bewaren!")
  60. (set #willdeletemsg "\nDe lade\n\n%s\n\nwordt in zijn geheel verwijderd.")
  61. (set #willdeletehelp "Laatste kans om oude files te bewaren: klik 'Stop'!")
  62. (set #deleteworkmsg "%s wordt verwijderd...")
  63. (set #oldversion "Oude versie")
  64. (set #deleteinstall "Wilt u de installatie-lade verwijderen?\n\n(die is niet langer nodig)")
  65. (set #installationfiles "Installatie files")
  66. (set #whereprompt "Waar moet Python geïnstalleerd worden? De meeste files hoeven niet gekopiëerd te worden, als u de standaard keuze accepteert.")
  67. (set #wherehelp "  Hier kunt u de lokatie van Python opgeven.\n  De installatie kan ter plekke plaatsvinden. Dit is aanbevolen als u de Python archive al in de juiste plaats heeft uitgepakt. In dit geval worden de meeste files met rust gelaten. Slechts een paar files worden naar hun benodigde lokatie gekopiëerd.\n  Als u een andere lokatie kiest, wordt een nieuwe lade (met ikoon) aangemaakt, waarin Python wordt geïnstalleerd.")
  68. (set #currentmsg "\nInstalleren van Python in\n\n%s\n\n(de huidige plaats)")
  69. (set #existingerr "Kan niet in bestaande lade installeren!")
  70. (set #oldstillexistserr "Kan oude lade niet volledig verwijderen! (wordt hij nog gebruikt?)")
  71. (set #newmsg "\nPython wordt geïnstalleerd in\n\n%s\n\n(een nieuwe lade)" )
  72. (set #whichprompt "Welke versie van het programma moet geïnstalleerd worden?")
  73. (set #whichhelp "Kies de versie die het beste bij uw CPU/FPU configuratie past.\nLees het README bestand voor informatie over hoe andere versies te verkrijgen.\n\n")
  74. (set #startupprompt "De volgende commando's zullen aan uw \"S:User-Startup\" bestand worden toegevoegd (ze zijn nodig om Python te kunnen gebruiken):\n\nASSIGN Python: %s\nPATH Python: ADD\n")
  75. (set #readmemsg (cat "Leest u AUB de getoonde informatie...\n\n\n(Het is ook verstandig om de README file te lezen)"))
  76. (set #ver_68020_IEEE "Python  68020, geen FPU")
  77. (set #ver_68030_882  "Python  68030, 68882 FPU")
  78. (set #abort "Stop")
  79. (set #proceed "Ga verder")
  80. )
  81. )
  82.  
  83. ;------------------------------------------------------------------------
  84. ;;;;
  85. ;;;; Subroutines follow below:
  86. ;;;;
  87.  
  88. ;;;;
  89. ;;;; Check if OS version is good enough.
  90. ;;;;
  91. (procedure checkKick
  92.  (if (< OSVersion 37)
  93.     (message #osmsg)
  94.  )
  95. )
  96.  
  97. ;;;;
  98. ;;;; Find out which pager to use ($PAGER or sys:utilities/multiview)
  99. ;;;;
  100. (procedure installPager
  101.  (set pager-cmd
  102.    (if (exists "ENV:PAGER" (noreq)) (getenv "PAGER") ("SYS:Utilities/Multiview")
  103.    )
  104.  )
  105. )
  106.  
  107. ;;;;
  108. ;;;; Ask user if she wants to delete an old version.
  109. ;;;;
  110. (procedure removeOldversion
  111. (if (askbool 
  112.     (prompt #oldversionmsg)
  113.     (help #oldversionhelp)
  114.     )
  115.     (
  116.         (set oldreleasepath "Python:")
  117.         (set oldreleasepath (expandpath
  118.             (askdir
  119.                 (prompt #whereisold)
  120.                 (help "Select directory")
  121.                 (default "Python:")
  122.             ) )
  123.         )    
  124.  
  125.         (if (askbool
  126.             (prompt (#willdeletemsg oldreleasepath))
  127.             (help #willdeletehelp)
  128.             (choices #proceed #abort)
  129.             )
  130.             (
  131.                 (working (#deleteworkmsg #oldversion))
  132.                 (run "assign Python: remove")
  133.                 (run ("delete >NIL: %s %s.info FORCE ALL" oldreleasepath oldreleasepath))
  134.                 ;;; Check if indeed all stuff went to the bitbasket
  135.                     (if (exists oldreleasepath) (abort #oldstillexistserr))
  136.             )
  137.             (abort)
  138.         )
  139.     )
  140. )
  141. )
  142.  
  143. ;;;;
  144. ;;;; Select destination. Create drawer if necessary.
  145. ;;;;
  146. (procedure selectDestination
  147. (set destination
  148.     (askdir
  149.         (prompt #whereprompt)
  150.         (help #wherehelp)
  151.         (newpath)
  152.         (default #source-dir)
  153.     )
  154. )    
  155.  
  156. (set @default-dest destination)
  157.  
  158. (if (= #source-dir destination)
  159.     (
  160.         (set #otherdir FALSE)
  161.         (message (#currentmsg destination))
  162.     )
  163.     (
  164.         (set #otherdir TRUE)
  165.         (set tempdest destination)
  166.         (set destination (tackon destination "Python-1.4"))
  167.  
  168.         (if (exists destination) (abort #existingerr))
  169.  
  170.         (message (#newmsg destination))
  171.         (makedir destination)
  172.         (copyfiles
  173.         (source (tackon #source-dir "Icons/Drawer.info"))
  174.         (dest tempdest)
  175.         (newname "Python-1.4.info")
  176.         )
  177.     )
  178. )
  179. )
  180.  
  181. ;;;;
  182. ;;;; Choose the desired binary version.
  183. ;;;;
  184. (procedure chooseBinary
  185. (set prog 1)
  186. (if (= cpu "68000") (set prog 0))
  187. (if (= cpu "68010") (set prog 0))
  188. (if (= cpu "68020") (set prog 0))
  189. (if (= cpu "68030") (set prog 1))
  190. (if (= cpu "68040") (set prog 1))
  191.  
  192. ; Ask version of program
  193. (set which_version
  194.         (askchoice
  195.                 (prompt #whichprompt)
  196.                 (help #whichhelp @askoptions-help)
  197.                 (choices
  198.             #ver_68020_IEEE
  199.             #ver_68030_882
  200.                 )
  201.                 (default prog)
  202.         )
  203. )
  204. )
  205.  
  206. ;;;;
  207. ;;;; Install the correct Python binary.
  208. ;;;;
  209. (procedure installprog
  210.  (if #otherdir
  211.    (
  212.     (if (= which_version 0)             ; 68020
  213.       (
  214.         (copyfiles
  215.         (source (tackon #source-dir "Python_020_IEEE"))
  216.         (dest destination)
  217.         (newname "Python")
  218.         )
  219.       )
  220.     )
  221.     (if (= which_version 1)             ; 68030+FPU
  222.       (
  223.         (copyfiles
  224.         (source (tackon #source-dir "Python_030_882"))
  225.         (dest destination)
  226.         (newname "Python")
  227.         )
  228.       )
  229.     )
  230.     (run ("delete >NIL: FORCE %s/python_#?" destination))
  231.    )
  232.    (
  233.     (if (= which_version 0)             ; 68020
  234.         (rename (tackon #source-dir "Python_020_IEEE") (tackon #source-dir "Python") )
  235.     )
  236.     (if (= which_version 1)             ; 68030+FPU
  237.         (rename (tackon #source-dir "Python_030_882") (tackon #source-dir "Python") )
  238.     )
  239.    )
  240.  )
  241. )
  242.  
  243.  
  244. ;;;;
  245. ;;;; Ask user if she wants to delete the installation drawer.
  246. ;;;;
  247. ;;;; BUG: hmm this doesnt work because installer keeps a lock in that drawer.
  248. ;;;;
  249. ;(procedure removeInstallation
  250. ;(if (askbool (prompt #deleteinstall) (help ""))
  251. ;    (
  252. ;    (working (#deleteworkmsg #installationfiles))
  253. ;    (message ("delete >NIL: %s %s.info FORCE ALL" #source-dir #source-dir))
  254. ;    (run ("delete >NIL: %s %s.info FORCE ALL" #source-dir #source-dir))
  255. ;    )
  256. ;)
  257. ;)
  258.  
  259.  
  260. ;------------------------------------------------------------------------
  261. ;;;;
  262. ;;;; Main installation sequence starts here
  263. ;;;;
  264.  
  265. (if (= @pretend 1)
  266.     (abort #nopretendmsg)
  267. )
  268.  
  269. (message #welcomemsg)
  270.  
  271. (checkKick)
  272.  
  273. (installPager)
  274.  
  275. (complete 0)
  276.  
  277. (removeOldversion)
  278.  
  279. (complete 10)
  280.  
  281. (selectDestination)
  282.  
  283. (complete 25)
  284.  
  285. (chooseBinary)
  286.  
  287. ;;;;
  288. ;;;; Now, install the files.
  289. ;;;;
  290. (if #otherdir
  291.   (
  292.     (installprog)
  293.     (complete 50)
  294.     (copyfiles
  295.     (source #source-dir)
  296.     (dest destination)
  297.     (pattern "(Lib|Demo|Docs|Icons)")
  298.     (infos)
  299.     )
  300.     (complete 90)
  301.     (copyfiles
  302.     (source (tackon #source-dir "DISCL_and_COPYRIGHT"))
  303.     (dest destination) (infos))
  304.     (copyfiles
  305.     (source (tackon #source-dir "README"))
  306.     (dest destination) (infos))
  307.     (copyfiles
  308.     (source (tackon #source-dir "Test.py"))
  309.     (dest destination) (infos))
  310.     (copyfiles
  311.     (source (tackon #source-dir "Icons/def_py.info"))
  312.     (dest destination)
  313.     (newname "Test.py.info")
  314.     )
  315.  
  316.     (copyfiles
  317.     (source (tackon #source-dir "Icons/Python.info"))
  318.     (dest destination)
  319.     (newname "Python.info")
  320.     )
  321.  
  322.     ;;;; Because we installed to another drawer, the installation files can be removed.
  323.     ;(removeInstallation)    ; Doesn't work: installer still locks drawer
  324.  
  325.   )
  326.   (
  327.     (complete 50)
  328.     (installprog)
  329.     (complete 75)
  330.     (copyfiles
  331.     (source (tackon #source-dir "Icons/Python.info"))
  332.     (dest destination)
  333.     (newname "Python.info")
  334.     )
  335.     (copyfiles
  336.     (source (tackon #source-dir "Icons/def_py.info"))
  337.     (dest destination)
  338.     (newname "Test.py.info")
  339.     )
  340.     (run ("delete >NIL: FORCE %s/(python_#?|install#?)" destination))
  341.   )
  342. )
  343.  
  344. (complete 95)
  345.  
  346. (startup @app-name
  347.         (prompt (#startupprompt destination))
  348.         (help @startup-help)
  349.         (command ("ASSIGN Python: %s\n" destination))
  350.         (command "PATH Python: ADD\n")
  351. )
  352.  
  353. (run ("ASSIGN >NIL: Python: %s" destination))
  354.  
  355. (if (exists "sys:utilities/multiview")
  356.     (run ("run sys:utilities/multiview %s/%s" destination "DISCL_and_COPYRIGHT") (safe))
  357.     (run (cat "run " pager-cmd) ("%s/%s" destination "DISCL_and_COPYRIGHT") (safe))
  358. )
  359.  
  360. (message #readmemsg)
  361.  
  362. (run "delete >NIL: ram:more FORCE")
  363.  
  364. (complete 100) ; 100% done!
  365.  
  366.